﻿@model Jb.Web.ViewModels.CoverLetterViewModel
@using Jb.Web.Utility;

@{
	String pageTitle = "Edit Cover Letter";
    if (Model != null && Model.ID == 0)
    {             
        pageTitle = "Add New Cover Letter";
    }
    ViewBag.Title = Html.GetPageTitle(pageTitle);
    ViewData[AppConstants.ViewDataKeys.SELECTED_MENU] = JobSeekerMenu.Coverletter;
    bool _HasSaved = ViewData.HasSaved();
}

<div class="jb-page-heading">
    <h1>@pageTitle</h1>
    <div>Enter necessary information and then click the Save button.</div>
</div>
<div class="jb-page-content">
@using (Html.BeginForm()) {
    @Html.ValidationSummary(false)

	if (Model == null)
    {
        @: @Html.WarningMessageBox("Sorry! Requested Cover Letter was not found for edit.")
    }
	else
	{
        if (_HasSaved) {
            @Html.SuccessMessageBox("Congratulations! Your Cover Letter saved successfully")
        }
        else if (ViewData[AppConstants.ViewDataKeys.SAVED] != null && !_HasSaved)
        {
            @Html.WarningMessageBox("Sorry! we could not save your Cover Letter.")
        }
		@Html.HiddenFor(model => model.ID)
	    @Html.HiddenFor(model => model.JobSeekerID)		
		
		<div class="editor-label">
			@Html.LabelFor(model => model.Title)
		</div>
		<div class="editor-field">
			@Html.TextBoxFor(model => model.Title, new { @class = "jb-long-text" })
			@Html.ValidationMessageFor(model => model.Title)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.Application)            
		</div>
        <div class="jb-label-hint">
            If you want to create paragraph in your application then, hit the "Enter" button 
            in your keyboard to start a new line, then start typing a new paragraph.
        </div>
		<div class="editor-field">
			@Html.TextAreaFor(model => model.Application, new { @class = "jb-long-text" })
			@Html.ValidationMessageFor(model => model.Application)
		</div>
		<div class="editor-label">
			@Html.LabelFor(model => model.IsDefault)
		</div>
		<div class="editor-field  jb-inline-label">
		    @Html.RadioButtonFor(model => model.IsDefault, "true", new { id = "rdnIsDefault_1" }) <label for="rdnIsDefault_1">Yes</label>
            @Html.RadioButtonFor(model => model.IsDefault, "false", new { id = "rdnIsDefault_0" }) <label for="rdnIsDefault_0">No</label>
		    @Html.ValidationMessageFor(model => model.IsDefault)
	    </div>
		<div class="jb-button-container">
			<button class="btn btn-primary" type="submit" data-loading-text="Saving..."><i class="icon-hdd icon-white"></i> Save</button> 
			<a href="@Url.JobSeekerUrl("List", "CoverLetter")" class="btn"><i class="icon-arrow-left"></i> Back to Cover Letter List</a>
		</div>		
    }
}
</div>
@section JavaScriptPlaceHolder
{
@Html.JavaScript("jquery.validate.min.js", Url)
@Html.JavaScript("jquery.validate.unobtrusive.min.js", Url)
}

